




/*
'===============================================================================
'  TuanHuy.BL.ProductsLanguageManagerBase
'===============================================================================
*/

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using TuanHuy.BLL;
using TuanHuy.DAL;
using TuanHuy.DAL.EntityClasses;
using TuanHuy.DAL.FactoryClasses;
using TuanHuy.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace TuanHuy.BLL
{
	public class ProductsLanguageManagerBase : ManagerBase
	{
		/// <summary>
		/// Purpose: Class constructor.
		/// </summary>
		
		public ProductsLanguageManagerBase()
		{
			// Nothing for now.
		}
		
		/*public override string TableName()
        {
            return "ProductsLanguage";
        }*/
		
		public ProductsLanguageEntity Insert(ProductsLanguageEntity _ProductsLanguageEntity)
		{
			return Insert(_ProductsLanguageEntity, "");
		}
		
		public ProductsLanguageEntity Insert(ProductsLanguageEntity _ProductsLanguageEntity, string controlId)
		{
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.SaveEntity(_ProductsLanguageEntity, true);
				ProductsLanguageFields field = new ProductsLanguageFields();
                //LogEntity(_ProductsLanguageEntity, field, AcInsert, controlId);
			}
			return _ProductsLanguageEntity;
		}

		
		public ProductsLanguageEntity Insert(decimal Id, decimal ProductId, int CategoryId, decimal LanguageId, string ProductName, string Descriptions, double Price, string Image, string Content)
		{
			ProductsLanguageEntity _ProductsLanguageEntity = new ProductsLanguageEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_ProductsLanguageEntity.Id = Id;
				_ProductsLanguageEntity.ProductId = ProductId;
				_ProductsLanguageEntity.CategoryId = CategoryId;
				_ProductsLanguageEntity.LanguageId = LanguageId;
				_ProductsLanguageEntity.ProductName = ProductName;
				_ProductsLanguageEntity.Descriptions = Descriptions;
				_ProductsLanguageEntity.Price = Price;
				_ProductsLanguageEntity.Image = Image;
				_ProductsLanguageEntity.Content = Content;
				ProductsLanguageFields field = new ProductsLanguageFields();
                //LogEntity(_ProductsLanguageEntity, field, AcInsert);
				adapter.SaveEntity(_ProductsLanguageEntity, true);
			}
			return _ProductsLanguageEntity;
		}

		/*public ProductsLanguageEntity Insert(decimal ProductId, int CategoryId, decimal LanguageId, string ProductName, string Descriptions, double Price, string Image, string Content)
		{
			ProductsLanguageEntity _ProductsLanguageEntity = new ProductsLanguageEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_ProductsLanguageEntity.ProductId = ProductId;
				_ProductsLanguageEntity.CategoryId = CategoryId;
				_ProductsLanguageEntity.LanguageId = LanguageId;
				_ProductsLanguageEntity.ProductName = ProductName;
				_ProductsLanguageEntity.Descriptions = Descriptions;
				_ProductsLanguageEntity.Price = Price;
				_ProductsLanguageEntity.Image = Image;
				_ProductsLanguageEntity.Content = Content;
				adapter.SaveEntity(_ProductsLanguageEntity, true);
				ProductsLanguageFields field = new ProductsLanguageFields();
                //LogEntity(_ProductsLanguageEntity, field, AcInsert);
			}
			return _ProductsLanguageEntity;
		}*/
		
		public bool Update(ProductsLanguageEntity _ProductsLanguageEntity)
        {
            return Update(_ProductsLanguageEntity, "");
        }

		public bool Update(ProductsLanguageEntity _ProductsLanguageEntity, string controlId)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				RelationPredicateBucket filter = new RelationPredicateBucket();
				IPredicateExpression _PredicateExpression = new PredicateExpression();
				_PredicateExpression.Add(ProductsLanguageFields.Id == _ProductsLanguageEntity.Id);
					
				filter.PredicateExpression.Add(_PredicateExpression);

				adapter.UpdateEntitiesDirectly(_ProductsLanguageEntity, filter);
				toReturn = true;
				
				ProductsLanguageFields field = new ProductsLanguageFields();
                //LogEntity(_ProductsLanguageEntity, field, AcUpdate, controlId);
			}
			return toReturn;
		}
		
		public bool Update(ProductsLanguageEntity _ProductsLanguageEntity, RelationPredicateBucket filter)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.UpdateEntitiesDirectly(_ProductsLanguageEntity, filter);
				toReturn = true;
				
				ProductsLanguageFields field = new ProductsLanguageFields();
                //LogEntity(_ProductsLanguageEntity, field, AcUpdate);
			}
			return toReturn;
		}

		public bool Update(decimal Id, decimal ProductId, int CategoryId, decimal LanguageId, string ProductName, string Descriptions, double Price, string Image, string Content)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				ProductsLanguageEntity _ProductsLanguageEntity = new ProductsLanguageEntity(Id);
				if (adapter.FetchEntity(_ProductsLanguageEntity))
				{
				
					_ProductsLanguageEntity.ProductId = ProductId;
					_ProductsLanguageEntity.CategoryId = CategoryId;
					_ProductsLanguageEntity.LanguageId = LanguageId;
					_ProductsLanguageEntity.ProductName = ProductName;
					_ProductsLanguageEntity.Descriptions = Descriptions;
					_ProductsLanguageEntity.Price = Price;
					_ProductsLanguageEntity.Image = Image;
					_ProductsLanguageEntity.Content = Content;
					adapter.SaveEntity(_ProductsLanguageEntity, true);
					toReturn = true;
					
					ProductsLanguageFields field = new ProductsLanguageFields();
					//LogEntity(_ProductsLanguageEntity, field, AcUpdate);
				}
			}
			return toReturn;
		}

		public bool Delete(decimal Id)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				ProductsLanguageEntity _ProductsLanguageEntity = new ProductsLanguageEntity(Id);
				if (adapter.FetchEntity(_ProductsLanguageEntity))
				{
					adapter.DeleteEntity(_ProductsLanguageEntity);
					toReturn = true;
				}
			}
			return toReturn;
		}
		
		public void DeleteAll() 
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", null);
			}
		}
		
		
		public int DeleteById(decimal Id)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByProductId(decimal ProductId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductId == ProductId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByCategoryId(int CategoryId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.CategoryId == CategoryId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByLanguageId(decimal LanguageId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.LanguageId == LanguageId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByProductName(string ProductName)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductName == ProductName);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByDescriptions(string Descriptions)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Descriptions == Descriptions);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByPrice(double Price)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Price == Price);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByImage(string Image)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByContent(string Content)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Content == Content);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("ProductsLanguageEntity", filter);
			}
			return toReturn;
		}
		

		
		public ProductsLanguageEntity SelectOne(decimal Id)
		{
			ProductsLanguageEntity toReturn = null;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				ProductsLanguageEntity _ProductsLanguageEntity = new ProductsLanguageEntity(Id);
				if (adapter.FetchEntity(_ProductsLanguageEntity))
				{
					toReturn = _ProductsLanguageEntity;
				}
			}
			return toReturn;
		}

		// Return DataTable
		public DataTable SelectAllRDT()
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, null, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectAllLST()
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, null, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectAllLST_Paged(int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, null, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}


		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByIdLST(decimal Id)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByIdLST_Paged(decimal Id, int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return DataTable
		public DataTable SelectByIdRDT(decimal Id)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByIdRDT_Paged(decimal Id, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByProductIdLST(decimal ProductId)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductId == ProductId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByProductIdLST_Paged(decimal ProductId, int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductId == ProductId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return DataTable
		public DataTable SelectByProductIdRDT(decimal ProductId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductId == ProductId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByProductIdRDT_Paged(decimal ProductId, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductId == ProductId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByCategoryIdLST(int CategoryId)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.CategoryId == CategoryId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByCategoryIdLST_Paged(int CategoryId, int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.CategoryId == CategoryId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return DataTable
		public DataTable SelectByCategoryIdRDT(int CategoryId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.CategoryId == CategoryId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByCategoryIdRDT_Paged(int CategoryId, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.CategoryId == CategoryId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByLanguageIdLST(decimal LanguageId)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.LanguageId == LanguageId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByLanguageIdLST_Paged(decimal LanguageId, int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.LanguageId == LanguageId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return DataTable
		public DataTable SelectByLanguageIdRDT(decimal LanguageId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.LanguageId == LanguageId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByLanguageIdRDT_Paged(decimal LanguageId, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.LanguageId == LanguageId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByProductNameLST(string ProductName)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductName == ProductName);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByProductNameLST_Paged(string ProductName, int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductName == ProductName);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return DataTable
		public DataTable SelectByProductNameRDT(string ProductName)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductName == ProductName);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByProductNameRDT_Paged(string ProductName, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.ProductName == ProductName);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByDescriptionsLST(string Descriptions)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Descriptions == Descriptions);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByDescriptionsLST_Paged(string Descriptions, int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Descriptions == Descriptions);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return DataTable
		public DataTable SelectByDescriptionsRDT(string Descriptions)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Descriptions == Descriptions);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByDescriptionsRDT_Paged(string Descriptions, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Descriptions == Descriptions);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByPriceLST(double Price)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Price == Price);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByPriceLST_Paged(double Price, int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Price == Price);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return DataTable
		public DataTable SelectByPriceRDT(double Price)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Price == Price);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByPriceRDT_Paged(double Price, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Price == Price);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByImageLST(string Image)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByImageLST_Paged(string Image, int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return DataTable
		public DataTable SelectByImageRDT(string Image)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByImageRDT_Paged(string Image, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByContentLST(string Content)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Content == Content);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return EntityCollection<ProductsLanguageEntity>
		public EntityCollection<ProductsLanguageEntity> SelectByContentLST_Paged(string Content, int PageNumber, int PageSize)
		{
			EntityCollection<ProductsLanguageEntity> _ProductsLanguageCollection = new EntityCollection<ProductsLanguageEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Content == Content);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_ProductsLanguageCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _ProductsLanguageCollection;
		}
		
		// Return DataTable
		public DataTable SelectByContentRDT(string Content)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Content == Content);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByContentRDT_Paged(string Content, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _ProductsLanguageCollection = new EntityCollection(new ProductsLanguageEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(ProductsLanguageFields.Content == Content);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_ProductsLanguageCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		

	}
}
